10 PRINT TAB(30);"TIC TAC TOE"
20 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 PRINT:PRINT:PRINT
50 REM
100 REM   THIS PROGRAM PLAYS TIC TAC TOE
110 REM   THE MACHINE GOES FIRST
120 PRINT "THE GAME BOARD IS NUMBERED:": PRINT
130 PRINT "1  2  3": PRINT "8  9  4": PRINT "7  6  5"
140 PRINT
150 REM
160 REM
170 REM
180 DEF FNM(X)=X-8*INT((X-1)/8)
190 REM
200 REM  MAIN PROGRAM
210 PRINT
220 PRINT
230 A=9
240 M=A
250 GOSUB 650
260 P=M
270 B=FNM(P+1)
280 M=B
290 GOSUB 650
300 Q=M
310 IF Q=FNM(B+4) THEN 360
320 C=FNM(B+4)
330 M=C
340 GOSUB 700
350 GOTO 730
360 C=FNM(B+2)
370 M=C
380 GOSUB 650
390 R=M
400 IF R=FNM(C+4) THEN 450
410 D=FNM(C+4)
420 M=D
430 GOSUB 700
440 GOTO 730
450 IF P/2<>INT(P/2) THEN 500
460 D=FNM(C+7)
470 M=D
480 GOSUB 700
490 GOTO 730
500 D=FNM(C+3)
510 M=D
520 GOSUB 650
530 S=M
540 IF S=FNM(D+4) THEN 590
550 E=FNM(D+4)
560 M=E
570 GOSUB 700
580 REM
590 E=FNM(D+6)
600 M=E
610 GOSUB 700
620 PRINT "THE GAME IS A DRAW."
630 GOTO 1000
640 REM
650 GOSUB 700
660 PRINT "YOUR MOVE";
670 INPUT M
680 RETURN
700 PRINT "COMPUTER MOVES";M
710 RETURN
720 REM
730 PRINT "AND WINS ********"
740 GOTO 210
750 END
